package org.tale.mscp.activemq.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;

@Component
//@EnableScheduling
public class Producer {


    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Queue queue;

    //    @Scheduled(fixedDelay = 2000)    // 每2s执行1次
    public void send(int times) {
        this.jmsMessagingTemplate.convertAndSend(this.queue, String.valueOf(times) + "i am test queue");
    }

}
